from django.shortcuts import render,HttpResponse,redirect,reverse
from django.http import JsonResponse

# Create your views here.

def index_handler(request):
    '''
    return HttpResponse("user_index")
    print(request.method)
    print(request.path)
    for key in request.META.keys():
        print(key,request.META[key])
    return HttpResponse("user:index")
    
    return HttpResponse(
        content="HTTPResponse",
        content_type='application/json',
        status=401
    )
    
    return JsonResponse(
        {
            'edu':'csdn',
            'coursec':'python'
        },
        json_dumps_params={'ensure_acsii':'False'}
    )
    return render(request, 'index.html')
'''
    context= {
        "username":"name1",
        "password":"pass1"
    }
    return render(request,"index.html",context)
    




def re_handler(request,num):
    return HttpResponse(num)


def user_handler(request,username):
    return HttpResponse('hello %s' %username)


def reverse_handler(request):
    print(reverse("user:index"))
    print(reverse("user:re",args=('1234',)))
    return HttpResponse('reverse')

def redirect_handler(request):
    return redirect(reverse('user:index'))